#include "stash.hpp"


#include "style.hpp"

#include <QDir>
#include <QDockWidget>
#include <QFileInfo>
#include <QIcon>
#include <QString>
#include <QWidget>


TileStash::
TileStash(QWidget * parent)
	: QScrollArea(parent)
{	
	load_tiles_from_directory();

	/* Setup tile grid */
	for (const auto & tileItem : tileItems)
		tileItemGrid.addWidget(tileItem);
}


void TileStash::
load_tiles_from_directory(const QDir & dir)
{
	const QStringList           extensions = {"*.bmp", "*.jpg", "*.png"};
	const QFlags<QDir::Filter>  filters =   QDir::Readable
		                                  | QDir::Writable
		                                  | QDir::Files
		                                  | QDir::CaseSensitive;
	QFileInfoList  tileFiles;
	TileItem *     tileItem;

	tileFiles = dir.entryInfoList(extensions, filters);
	for (const QFileInfo & tileFile : tileFiles) {
		tileItem = new TileItem(tileFile.filePath());
	    tileItems.push_back(tileItem);
	}
}


void TileStash::
slot_receive_from_editor()
{
	
}
